package org.kzwl.book.controller.app;


import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.kzwl.comm.advice.BizException;
import org.kzwl.comm.pojo.ResponseData;
import org.kzwl.comm.pojo.bo.agree.AgreeBO;
import org.kzwl.entity.app.Book;
import org.kzwl.service.app.AgreeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 张国伟/郭家恒
 * @since 2020-09-10
 */
@RestController
@RequestMapping("/agree")
@Api("点赞")
public class AgreeController {

    @Autowired
    private AgreeService agreeService;

    @ApiOperation(value = "点赞")
    @PostMapping("/addAgree")
    public ResponseData<Void> addAgree(@RequestBody AgreeBO bo) {
        agreeService.addAgree(bo);
        return new ResponseData<>();
    }

    @ApiOperation(value = "取消点赞")
    @PostMapping("/removeAgree")
    public ResponseData<Void> removeAgree(@RequestBody AgreeBO bo) {
//        throw new BizException("123");
        agreeService.removeAgree(bo);
        return new ResponseData<>();
    }

}
